package com.hc.server.util;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.imageio.stream.ImageInputStream;
import com.sun.image.codec.jpeg.JPEGCodec;

public class ImageConverter {

	public static boolean zoomImage(String imgSrc, String imgDest, Float scale, Integer fixed_width, Integer fixed_height) throws Exception{
		if(imgDest == null || 0 == imgDest.trim().length()){
			return false;
		}
		File file = new File(imgSrc);
		if(null == file || !file.exists() || !file.isFile()){
			return false;
		}
		
		return zoomImage(new FileInputStream(file), imgDest, scale, fixed_width, fixed_height);
	}

	private static boolean zoomImage(InputStream input,
			String imgDest, Float scale, Integer fixedWidth, Integer fixedHeight) throws Exception {
		if(imgDest == null || 0 == imgDest.trim().length()){
			return false;
		}
		if(null == input){
			return false;
		}
	
		return zoomImage(javax.imageio.ImageIO.read(input), imgDest, scale, fixedWidth, fixedHeight);
	}

	private static boolean zoomImage(Image srcImage, String imgDest,
			Float scale, Integer fixedWidth, Integer fixedHeight) {
		int src_w = srcImage.getWidth(null);
		int src_h = srcImage.getHeight(null);
		
		if(null == scale || scale <= 0){
			
		}
		
		return false;
	}
}
